<?php


?>
<div class="btn btn-primary lpexport">导出</div>

<form id="downloadform" action="/api/downloadpdf" method="post">
    <input type="hidden" name="pdfdata">
</form>
<iframe id="iframe-richeng" src="https://xxx.com/site/load-richeng.html?siteid=10301"
        width="100%" height="1000px"
></iframe>

<script>
    $(document).on('click', '.lpexport', function () {
        // var $txt = $(document.getElementById('iframe1').contentWindow.document.body).find("#Text1").val();
        var html = $(document.getElementById('iframe-richeng').contentWindow.document.body).html();
        html = encodeURI(html);
        // var html  = '<div>aaa</div>';
        $("input[name=pdfdata]").val(html);
        $("#downloadform").submit();
    })
</script>
